package com.sise.wangzhan.controller;

import com.sise.wangzhan.client.PersonClient;
import com.sise.wangzhan.entity.Person;
import com.sise.wangzhan.myclientcofigure.MyClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname InvokerController
 * @Description TODO
 * @Date 2020/4/16 11:55
 * @Created by wangzhan
 */
@RestController
@Configuration
public class InvokerController {

//    @Autowired
//    private PersonClient personClient;

    @Autowired
    private MyClient myClient;

//    @RequestMapping(value = "/invokerHello", method = RequestMethod.GET)
//    public String invokerHello(){
//        return personClient.hello();
//    }
//
//    @RequestMapping(value = "/router", method = RequestMethod.GET,
//                    produces = MediaType.APPLICATION_JSON_VALUE)
//    @ResponseBody
//    public String router(){
//        Person person = personClient.getPerson(2);
//        return person.getMessage();
//    }

    @RequestMapping(value = "/testContract",method = RequestMethod.GET,
                    produces =  MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public String testContract(){
        String springResult = myClient.otherHello();
        System.out.println("使用@RequestMapping 注解的接口返回的结果："+springResult);

        String myResult = myClient.myHello();
        System.out.println("使用@MyUrl 注解的接口返回的结果："+myResult);

        return "请查看控制台信息";
    }




}
